from flask_project import db

class bank_logger(db.Model):
    __tablename__ = "bank_logger"
    id = db.Column(db.Integer,primary_key=True)
    wid = db.Column(db.Integer,unique=True)#账单id
    uid = db.Column(db.String(64))#用户id
    
    bank_name = db.Column(db.String(64))#银行用户名
    bank_account = db.Column(db.String(64))#银行帐号
    money = db.Column(db.String(10))#银行金额
    start_time = db.Column(db.DateTime)#标准时间
    modify_time = db.Column(db.DateTime)
    is_lock = db.Column(db.Integer)
    is_finish = db.Column(db.Integer)


class message_logger(db.Model):
    __tablename__ = "message_logger"
    id = db.Column(db.Integer,primary_key=True)
    sender_phone = db.Column(db.String(64))#短信发送者号码
    IMSI = db.Column(db.String(64))#短信接收者号码的IMSI
    content = db.Column(db.Text)#短信内容
    create_time = db.Column(db.DateTime)#标准时间
    is_use = db.Column(db.Integer,default=0)

    def toJson(self):
        return {"id":self.id,"sender_phone":self.sender_phone,"IMSI":self.IMSI,
                "content":self.content,"create_time":self.create_time.strftime('%Y-%m-%d %H:%M:%S')}